package com.hehao;

import java.util.Arrays;
import java.util.Iterator;
import java.util.List;
import java.util.stream.Stream;

/**
 * @author Damon
 * @date 2023/6/27
 */
public class TempDemo {
    public static void main(String[] args) {
//        int[] nums = {-3,-2,-1,0,0,1,2};
//        System.out.println(maximumCount(nums));
//        Flux.generate(()->0,(i,sink) -> {
//            sink.next("2 *" + i + "=" + 2*i);
//            if (i==9) sink.complete();
//            return i + 1;
//        }).subscribe(System.out::println);
//        List<Integer> list = new ArrayList<>(List.of(1,2,3,4,5,6));
//        List<Long> longList = list.stream().map(o -> Long.valueOf(o.toString())).collect(Collectors.toCollection(ArrayList::new));
//        Iterator<Long> its = longList.iterator();
//        while (its.hasNext()) {
//            Long next = its.next();
//            System.out.println("next = " + next);
//            its.remove();
//        }
//        System.out.println(longList);
        Stream<String> stream = Stream.of("a", "b", "c");
        List<String> list = stream.toList();
        Iterator<String> its = list.iterator();
        while (its.hasNext()) {
            its.next();
            its.remove();
        }
        System.out.println(list);
    }


    public static int maximumCount(int[] nums) {
        int highMax = 0;
        int lowMax = 0;
        List<Integer> numList = Arrays.stream(nums).boxed().toList();
        highMax = (int)numList.stream().filter(o -> o > 0).count();
        lowMax = (int)numList.stream().filter(o -> o < 0).count();
        return Math.max(highMax, lowMax);
    }
}